package com.ailot.cloud.upms.api.controller;

import com.ailot.cloud.upms.api.service.SysGenService;
import com.ailot.cloud.upms.common.entity.SysGen;
import com.ailot.cloud.upms.common.entity.SysTable;
import lombok.AllArgsConstructor;
import lombok.NonNull;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * 代码生成
 *
 * @Author : litao
 * @create 2023/12/6 14:40
 */
@RestController
@RequestMapping("/gen")
@AllArgsConstructor
public class SysGenController {

    private final SysGenService sysGenService;

    @GetMapping("/list")
    public List<SysTable> list(String tableName, @NonNull String datasourceId) {
        return sysGenService.list(tableName, datasourceId);
    }

    @PostMapping("/view")
    public Map<String, String> view(@RequestBody SysGen sysGen) {
        return sysGenService.view(sysGen);
    }

}
